package me.chanjar.weixin.open.bean.result;

import lombok.Data;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

@Data
public class WxLlzResult implements Serializable {
  protected String ret;
  protected String err_msg;
  protected String status;

  /**
   * 请求是否成功.
   */
  public boolean isSuccess() {
    return StringUtils.equalsIgnoreCase(ret, "0");
  }

  public static WxLlzResult fromJson(String json) {
    return WxGsonBuilder.create().fromJson(json, WxLlzResult.class);
  }

  @Override
  public String toString() {
    return WxOpenGsonBuilder.create().toJson(this);
  }
}
